home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
flip
/
flip.frm
< prev
next >
Wrap
Text File
|
1995-12-05
|
9KB
|
273 lines
VERSION 2.00
Begin Form Flip
BackColor = &H00FF0000&
BorderStyle = 1 'Fixed Single
Caption = "Flip"
ClientHeight = 4950
ClientLeft = 1185
ClientTop = 1500
ClientWidth = 4950
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 5355
Icon = FLIP.FRX:0000
Left = 1125
LinkMode = 1 'Source
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 330
ScaleMode = 3 'Pixel
ScaleWidth = 330
Top = 1155
Width = 5070
Begin PictureBox Picture1
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 990
Left = 270
Picture = FLIP.FRX:0302
ScaleHeight = 66
ScaleMode = 0 'User
ScaleWidth = 66
TabIndex = 0
Top = 840
Visible = 0 'False
Width = 990
End
Begin PictureBox Picture3
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 990
Left = 1290
Picture = FLIP.FRX:0CC4
ScaleHeight = 66
ScaleMode = 0 'User
ScaleWidth = 66
TabIndex = 2
Top = 840
Visible = 0 'False
Width = 990
End
Begin PictureBox Picture5
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 990
Left = 2340
Picture = FLIP.FRX:1686
ScaleHeight = 66
ScaleMode = 0 'User
ScaleWidth = 66
TabIndex = 4
Top = 840
Visible = 0 'False
Width = 990
End
Begin PictureBox Picture2
AutoRedraw = -1 'True
BorderStyle = 0 'None
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 990
Left = 3480
ScaleHeight = 66
ScaleMode = 0 'User
ScaleWidth = 66
TabIndex = 1
Top = 840
Visible = 0 'False
Width = 990
End
Begin PictureBox Picture4
AutoRedraw = -1 'True
BorderStyle = 0 'None
FontBold = -1 'True
FontItalic = 0 'False
FontName = "System"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 480
Left = 0
Picture = FLIP.FRX:2048
ScaleHeight = 32
ScaleMode = 0 'User
ScaleWidth = 800
TabIndex = 3
Top = 3120
Visible = 0 'False
Width = 12000
End
End
Declare Function BitBlt% Lib "gdi" (ByVal destDC%, ByVal x%, ByVal Y%, ByVal w%, ByVal H%, ByVal srcDC%, ByVal xSrc%, ByVal ySrc%, ByVal Rop&)
Declare Function StretchBlt% Lib "gdi" (ByVal destDC%, ByVal x%, ByVal Y%, ByVal w%, ByVal H%, ByVal srcDC%, ByVal xSrc%, ByVal ySrc%, ByVal wSrc%, ByVal hSrc%, ByVal Rop&)
Const SRCCOPY = &HCC0020
Dim cxBorders%, cyBorders%, Flipped%(63)
Sub Form_Load ()
x% = MsgBox("- Left button flips cells" + Chr$(13) + "- Right button X's out Cells", 0, "Mouse buttons")
Picture2.BackColor = Flip.BackColor
Picture2.Height = Picture1.Height
Picture2.Width = Picture1.Width
End Sub
Sub Form_MouseUp (Button As Integer, Shift As Integer, x As Single, Y As Single)
'* Determine what Cell was clicked and what Icon should
'* be displayed when flipped.
IX% = x \ Picture1.Width
IY% = Y \ Picture1.Height
IconNum% = IX% + (IY% * 5)
'* Determine upper left hand corner of Cell within form
IX% = IX% * Picture1.Width
IY% = IY% * Picture1.Height
'* Copy Icon from IconsBitmap to middle of "Working"
'* Picture control in preparation for flipping.
'* If displaying the Icon, The icon is inverted horizontally
'* before flipping so when it is flipped, it appears normally
If Button = 1 Then
If Flipped%(IconNum%) Then
Z% = BitBlt(Picture3.hDC, 18, 18, 32, 32, Picture4.hDC, IconNum% * 32, 0, SRCCOPY)
Else
Z% = StretchBlt(Picture3.hDC, 49, 18, -32, 32, Picture4.hDC, IconNum% * 32, 0, 32, 32, SRCCOPY)
End If
FlipWidth% = Picture1.Width
'* Flip the Cell
For I% = 0 To Picture1.Width Step 10
Picture2.Cls
If Flipped%(IconNum%) Then
'* Flip cell horizontally
If ((Not Flipped%(IconNum%)) And (I% < Picture1.Width \ 2)) Or (Flipped%(IconNum%) And (I% >= Picture1.Width \ 2)) Then
Z% = StretchBlt(Picture2.hDC, 0, I%, Picture1.Height, FlipWidth%, Picture1.hDC, 0, 0, CInt(Picture1.Width), CInt(Picture1.Height), SRCCOPY)
Else
Z% = StretchBlt(Picture2.hDC, 0, I%, Picture1.Height, FlipWidth%, Picture3.hDC, 0, 0, CInt(Picture1.Width), CInt(Picture1.Height), SRCCOPY)
End If
Else
'* Flip cell Vertically
If ((Not Flipped%(IconNum%)) And (I% < Picture1.Width \ 2)) Or (Flipped%(IconNum%) And (I% >= Picture1.Width \ 2)) Then
Z% = StretchBlt(Picture2.hDC, I%, 0, FlipWidth%, Picture1.Height, Picture1.hDC, 0, 0, CInt(Picture1.Width), CInt(Picture1.Height), SRCCOPY)
Else
Z% = StretchBlt(Picture2.hDC, I%, 0, FlipWidth%, Picture1.Height, Picture3.hDC, 0, 0, CInt(Picture1.Width), CInt(Picture1.Height), SRCCOPY)
End If
End If
'* Display partially flipped Cell on Form
Z% = BitBlt(hDC, IX%, IY%, Picture1.Width, Picture1.Height, Picture2.hDC, 0, 0, SRCCOPY)
FlipWidth% = FlipWidth% - 20
Next
Flipped%(IconNum%) = Not Flipped%(IconNum%)
'* Display final cell on Form, either Icon cell or
'* or normal unflipped cell background
If Flipped%(IconNum%) Then
Z% = BitBlt(Picture3.hDC, 18, 18, 32, 32, Picture4.hDC, IconNum% * 32, 0, SRCCOPY)
Z% = BitBlt(hDC, IX%, IY%, Picture1.Width, Picture1.Height, Picture3.hDC, 0, 0, SRCCOPY)
Else
Z% = BitBlt(hDC, IX%, IY%, Picture1.Width, Picture1.Height, Picture1.hDC, 0, 0, SRCCOPY)
End If
ElseIf Button = 2 Then
'* X out cell
XWidth% = 2
For I% = (Picture1.Width \ 2) - 2 To 0 Step -4
Z% = StretchBlt(hDC, IX% + I%, IY% + I%, XWidth%, XWidth%, Picture5.hDC, 0, 0, CInt(Picture1.Width - 2), CInt(Picture1.Height - 2), SRCCOPY)
XWidth% = XWidth% + 8
Next
Z% = BitBlt(hDC, IX%, IY%, Picture1.Width, Picture1.Height, Picture5.hDC, 0, 0, SRCCOPY)
End If
End Sub
Sub Form_Paint ()
'* Repaint form row by row, copying normal backgroup
'* cell bitmap to form if cell is not flipped, or the